package com.example.sqlitelogin.tools;

//* 下面是电视遥控器编码
//        长虹电视遥控器 红外码组成如下
//        NEC协议是红外通信的协议之一, 单次发送由引导码+地址码+地址码反码+数据码+数据码反码+结束码6部分组成

//        引导码的组成
//        引导码由9ms的低电平和4.5ms的空闲(即高电平)组成.
//
//        如果我们规定一拍是562us, 那么引导码就是16拍的红外发射+8拍的空闲.
//
//        0和1的表示
//        地址码和数据码都是由0和1组成的.
//
//        0的表示是1拍的发射+1拍的空闲.
//
//        1的表示是1拍的发射+3拍的空闲.
//
//        每段编码的发送顺序是从最低位(LSB, Lowest Significant Bit)开始发送.
//
//        结束码
//        结束码就是1拍的发射信号.
//
//        如果没有结束码, 最后一位数据将无法区分是0还是1.
public class CodeCommandtv {
    //编码规则
    //起始码S电平宽度为：9000us低电平+4500us高电平
    public static final int startdown = 0;
    public static final int startup = 562;

    //连接码C电平宽度为：600us低电平+20000us高电平
    public static final int connectdown = 562;
    public static final int connectup = 20000;

    //数据码由0，1组成：
    //0的电平宽度为：600us低电平+600us高电平，
    public static final int zerodown = 562;
    public static final int zeroup = 562;

    //1的电平宽度为：600us低电平+1600us高电平
    public static final int onedown = 562;
    public static final int oneup = 1600;

    //命令格式（数组内的数值拼接）


    //模式自动数组（扫风）开机
    public static final int[] auto11 = {
            startdown, startup,//起始码
            onedown, oneup, onedown, oneup, zerodown, zeroup,//1-3
            onedown, oneup, zerodown, zeroup, zerodown, zeroup,//4-6
            onedown, oneup, zerodown, zeroup, zerodown, zeroup,//7-9
            onedown, oneup, onedown, oneup, onedown, oneup, //10-12
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//13-15
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//16-18
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//19-21
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//22-24
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//25-27
            zerodown, zeroup, onedown, oneup, zerodown, zeroup,//28-30
            onedown, oneup, zerodown, zeroup, zerodown, zeroup,//31-33
            onedown, oneup, zerodown, zeroup,//34-35  前35位数据码结束
            connectdown, connectup,//连接码   后32位开始
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//36-38
            zerodown, zeroup, onedown, oneup, zerodown, zeroup,//39-41
            zerodown, zeroup, zerodown, zeroup, onedown, oneup,//42-44
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//45-47
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//48-50
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//51-53
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//54-56
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//57-59
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//60-62
            zerodown, zeroup, //63
            onedown, oneup, onedown, oneup, onedown, oneup, zerodown, zeroup, //64-67(四位检验码)后32位结束
//            0110，1010
    };

    //模式自动数组（扫风）开机
    public static final int[] auto12 = {
            9000, 4500,
            600, 600, 600, 600, 600, 600,//模式0自动
            600, 1600, 600, 600, 600, 600,//开，风速自动
            600, 1600, 600, 600, 600, 600,//扫风
            600, 600, 600, 1600, 600, 1600,//28度
            600, 600, 600, 600, 600, 600,
            600, 600, 600, 600, 600, 600,
            600, 600, 600, 600, 600, 600,
            600, 1600, 600, 600, 600, 600,//灯光开
            600, 600, 600, 600, 600, 600,
            600, 600, 600, 1600, 600, 600,
            600, 1600, 600, 600, 600, 600,
            600, 1600, 600, 600,
            600, 20000,
            600, 600, 600, 600, 600, 600,
            600, 600, 600, 600, 600, 600,
            600, 600, 600, 600, 600, 1600,//温度显示
            600, 600, 600, 600, 600, 600,
            600, 600, 600, 600, 600, 600,
            600, 600, 600, 600, 600, 600,
            600, 600, 600, 600, 600, 600,
            600, 600, 600, 600, 600, 600,
            600, 600, 600, 600, 600, 600,
            600, 600,
            600, 1600, 600, 1600, 600, 1600, 600, 1600
    };

    /**
     * 大数组模块
     * 全部置通用 在替换
     */

    //模式自动数组（扫风）开机
    public static final int[] base1 = {
            startdown, startup,//起始码
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//1-3
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//4-6
            onedown, oneup, zerodown, zeroup, zerodown, zeroup,//7-9
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//10-12
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//13-15
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//16-18
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//19-21
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//22-24
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//25-27
            zerodown, zeroup, onedown, oneup, zerodown, zeroup,//28-30
            onedown, oneup, zerodown, zeroup, zerodown, zeroup,//31-33
            onedown, oneup, zerodown, zeroup,//34-35  前35位数据码结束
            connectdown, connectup,//连接码   后32位开始
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//36-38
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//39-41
            zerodown, zeroup, zerodown, zeroup, onedown, oneup,//42-44
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//45-47
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//48-50
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//51-53
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//54-56
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//57-59
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//60-62
            zerodown, zeroup, //63
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//64-67(四位检验码)后32位结束

    };

    //校验码--1
    public static int check_d = onedown;
    public static int check_u = oneup;


}

